package leetcode.easy.q119;

import java.util.Arrays;
import java.util.List;

public class Q {
}

class Solution {
    /**
     * dp[i][j]=dp[i][j-1]*(i-j+1)/j
     */
    public List<Integer> getRow(int rowIndex) {
        Integer[] arr = new Integer[rowIndex + 1];
        arr[0] = 1;
        for (int i = 1; i <= rowIndex; i++) {
            arr[i] = Long.valueOf(1L * arr[i - 1] * (rowIndex - i + 1) / i).intValue();
        }
        return Arrays.asList(arr);
    }
}